#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QTcpServer>
#include <QTcpSocket>
#include <QDateTime>

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <QLabel>
using namespace std;

typedef struct{
    QPoint start;
    QPoint end;
}Line;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    bool event(QEvent *event);
    void send_str(char sendBuf[]);

    void drawPoint(int x, int y);

    void paintEvent(QPaintEvent *event);

    void showLabel(int step);

    void judgeEvent(QEvent *event);

private slots:
    void on_btn_clicked();

    void on_btn_2_clicked();

    void on_btn_3_clicked();

    void on_btn_4_clicked();

    void on_netDown_clicked();

private:
    Ui::MainWindow *ui;

    QTcpServer  *tcpServer;//监听套接字
    QTcpSocket  *tcpSocket;//通信套接字

    bool isOpen;
    bool canPress;
    bool showNet;

    int netStep;
    int x;
    int y;

    int startX;

    vector<QLabel*> net;
};

#endif // MAINWINDOW_H
